<?php
	
	require 'viewer.php';
	
	$stitchid = $_GET{'stitchid'};
	$count = $_GET{'count'};
	$terms = $_GET{'terms'};
	$images = getImagesNear($stitchid, $count, $terms);
	echo "thumb_images = new Array();\n";
	
	for($i=0; $i<count($images); $i++) {
		
		if(is_null($images[$i])) return;
		
		$id = $images[$i]->stitchid;
		$title = $images[$i]->title;
		$author = $images[$i]->author;

		if(is_null($id)) return;

		echo "thumb_images[$i] = new Object();\n";
		echo "thumb_images[$i].id = $id;\n";
		echo "thumb_images[$i].title = \"$title\";\n";
		echo "thumb_images[$i].author = \"$author\";\n";
		echo "thumb_images[$i].img = \"http://www.srcf.ucam.org/cshotel/stitched/" . $id . "_thumb.jpg\";\n";
		echo "thumb_images[$i].src = \"http://www.srcf.ucam.org/cshotel/stitched/" . $id . ".xml\";\n";
		
	}
?>